package cn.edu.cqu.domains;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;


/**
 * 用户
 * 
 * @author liuji
 * 
 */
@Entity
@Table(name = "users", uniqueConstraints = { @UniqueConstraint(columnNames = { "loginName" }) })
public class User implements Serializable{
	@Id
	@GeneratedValue
	private Long id;
	/**
	 * 登录名
	 */
	@Column(nullable = false, length = 100)
	private String loginName;
	/**
	 * 姓名
	 */
	@Column(nullable = true, length = 100)
	private String name;
	/**
	 * 密码
	 */
	@Column(nullable = false, length = 100)
	private String pwd;
	/**
	 * 用户类型 系统管理员：a 普通用户：u
	 */
	@Enumerated(EnumType.ORDINAL)
	private UserType type;
	/**
	 * 性别 男：m 女：f
	 */
	@Column(nullable = true, length = 1)
	private String sex;

	/**
	 * 手机
	 */
	@Column(nullable = true, length = 100)
	private String mobilePhone;
	/**
	 * email
	 */
	@Column(nullable = true, length = 100)
	private String email;

	
	/**
	 * 奖学金类型scholarshipType
	 */
	@Enumerated(EnumType.ORDINAL)
	@Column(nullable = true)
	private ScholarshipType scholarshipType;
	/**
	 * 获奖时间scholarshipTime
	 */
	@Column(nullable = true)
	private Date scholarshipTime;
	/**
	 * 团内职务partyPost
	 */
	@Column(nullable = true, length = 100)
	private String partyPost;
	/**
	 * 重大学号cquNo
	 */
	@Column(nullable = true, length = 20)
	private String cquNo;
	/**
	 * 现居单位/学校currentAddress
	 */
	@Column(nullable = true, length = 200)
	private String currentAddress;
	/**
	 * 银行卡开户银行bankName
	 */
	@Column(nullable = true, length = 100)
	private String bankName;
	/**
	 * 银行卡号bankNo
	 */
	@Column(nullable = true, length = 30)
	private String bankNo;
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	public ScholarshipType getScholarshipType() {
		return scholarshipType;
	}

	public void setScholarshipType(ScholarshipType scholarshipType) {
		this.scholarshipType = scholarshipType;
	}

	public Date getScholarshipTime() {
		return scholarshipTime;
	}

	public void setScholarshipTime(Date scholarshipTime) {
		this.scholarshipTime = scholarshipTime;
	}

	public String getPartyPost() {
		return partyPost;
	}

	public void setPartyPost(String partyPost) {
		this.partyPost = partyPost;
	}

	public String getCquNo() {
		return cquNo;
	}

	public void setCquNo(String cquNo) {
		this.cquNo = cquNo;
	}

	public String getCurrentAddress() {
		return currentAddress;
	}

	public void setCurrentAddress(String currentAddress) {
		this.currentAddress = currentAddress;
	}

	public String getBankName() {
		return bankName;
	}

	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	public String getBankNo() {
		return bankNo;
	}

	public void setBankNo(String bankNo) {
		this.bankNo = bankNo;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	


	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public UserType getType() {
		return type;
	}

	public void setType(UserType type) {
		this.type = type;
	}

	public Long getId() {
		return id;
	}

	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((loginName == null) ? 0 : loginName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (loginName == null) {
			if (other.loginName != null)
				return false;
		} else if (!loginName.equals(other.loginName))
			return false;
		return true;
	}


}
